package com.hangim.pce.common.search.controller;

import com.hangim.pce.common.search.service.ESSearchService;
import com.hangim.pce.common.web.WebRequestContext;
import com.github.pig.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("search")
public class SearchController extends BaseController {
    @Autowired
    protected ESSearchService searchService;

    @RequestMapping("{searchType}")
    @ResponseBody
    public Page search(@PathVariable("searchType") String searchType, WebRequestContext context) {
        return searchService.search(context, searchType);
    }
}
